﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EasyToHelp.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using EasyToHelp.Common;

namespace EasyToHelp.WAP.Controllers
{
    [Authorize]
    public class BaseController : Controller
    {
        /// <summary>
        /// 获取当前登录人所有信息
        /// </summary>
        /// <returns></returns>
        public Member MemberUser()
        {
            return JsonHelper.DeserializeJsonToObject<Member>(HttpContext.User.Claims.Last().Value);
        }
        /// <summary>
        /// 获取当前登录人Id
        /// </summary>
        /// <returns></returns>
        public int UserId()
        {
            return MemberUser().Id;
        }
    }
}